<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %>
<%
    String path = request.getContextPath();
    String basePath = request.getScheme() + "://" + request.getServerName() + ":" + request.getServerPort() + path + "/";
%>
<c:set var="basePath" value="<%=basePath%>"/>
<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="utf-8">
    <title>jthiner</title>
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <link rel="stylesheet" href="${basePath}static/bootstrap/css/bootstrap.min.css" media="screen">
    <link rel="stylesheet" href="${basePath}static/bootswatch/bootswatch.min.css">
    <link rel="stylesheet" href="${basePath}static/css/front/index/index.css">
    <%--<link rel="stylesheet" href="${basePath}static/css/common/main.css">--%>
</head>
<body>
<div class="navbar navbar-default navbar-fixed-top">
    <div class="container">
        <div class="navbar-header">
            <a href="${basePath}index" class="navbar-brand">jBlog</a>
            <button class="navbar-toggle" type="button" data-toggle="collapse" data-target="#navbar-main">
                <span class="icon-bar"></span>
                <span class="icon-bar"></span>
                <span class="icon-bar"></span>
            </button>
        </div>
        <div class="navbar-collapse collapse" id="navbar-main">
            <ul class="nav navbar-nav">

                <c:forEach items="${categorys}" var="category">
                    <c:choose>
                        <c:when test="${!empty category.children}">

                            <li class="dropdown">
                                <a class="dropdown-toggle" data-toggle="dropdown" id="category_${category.id}" href="${basePath}cat/${category.slug}">
                                        ${category.name}
                                    <span class="caret"></span>
                                </a>

                                <ul class="dropdown-menu" aria-labelledby="category_${category.id}">
                                    <li>
                                        <a href="${basePath}cat/${category.slug}">
                                                ${category.name}
                                        </a>
                                    </li>
                                    <li class="divider"></li>

                                    <c:forEach items="${category.children}" var="child">
                                        <li><a href="${basePath}cat/${child.slug}">${child.name}</a></li>
                                    </c:forEach>
                                </ul>
                            </li>

                        </c:when>
                        <c:otherwise>

                            <li><a href="${basePath}cat/${category.slug}">${category.name}</a></li>

                        </c:otherwise>
                    </c:choose>

                </c:forEach>


            </ul>

            <ul class="nav navbar-nav navbar-right">

                <c:choose>
                    <c:when test="${sessionScope.session_user!=null}">
                        <li><a href="${basePath}admin/index">管理后台</a></li>
                        <li><a href="${basePath}doLogout">登出</a></li>
                    </c:when>
                    <c:otherwise>
                        <li><a href="${basePath}gotoLogin">登录</a></li>
                    </c:otherwise>
                </c:choose>

            </ul>

        </div>
    </div>
</div>


<div class="container">

    <div class="posts">

        <div class="row post text">
            <div class="col-lg-2">
                <div class="date">
                    <fmt:formatDate value="${post.post_modified}" pattern="yyyy年MM月dd日"/>
                </div>
            </div>

            <div class="col-lg-6 entry">
                <div class="title">
                    <h2>
                        ${post.title}
                    </h2>
                </div>
                <div class="POST">
                    ${post.content}
                </div>
            </div>
        </div>

    </div>


    <footer>
        <div class="row">
            <div class="col-lg-12">

                <p>
                    本站由<a href="https://www.vultr.com/">vultr</a>提供
                </p>
            </div>
        </div>

    </footer>


</div>


<script src="${basePath}static/jquery/jquery-2.1.3.min.js"></script>
<script src="${basePath}static/bootstrap/js/bootstrap.min.js"></script>
<script src="${basePath}static/bootswatch/bootswatch.js"></script>


</body>
</html>